<%@ page language="java" import="java.util.*,Bean.RestMessage" pageEncoding="utf-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="./css/main.css" media="all" />
	<title>餐馆页面</title>
</head>
	<body>
<%
List<RestMessage> userList = (List<RestMessage>)session.getAttribute("REST_LIST");
int pageCount = (Integer)session.getAttribute("PAGE_COUNT");
int pageNow = (Integer)session.getAttribute("PAGE_NOW");
int dishStyleId =(Integer)session.getAttribute("DISH_STYLE_ID");
 %>
 <div id="main" align="center">
 <h3>
 <%
 	switch(dishStyleId){
 		case 1:out.print("鲁菜馆列表");break;
 		case 2:out.print("川菜馆列表");break;
 		case 3:out.print("粤菜馆列表");break;
 		case 4:out.print("苏菜馆列表");break;
 		case 5:out.print("闽菜馆列表");break;
 		case 6:out.print("浙菜馆列表");break;
 		case 7:out.print("湘菜馆列表");break;
 		case 8:out.print("徽菜馆列表");break;
 	}
 %>
 </h3>
<table border=1>
<tr align="center"><td>餐馆名称</td><td>餐馆电话</td><td>餐馆地址</td><td>简介</td></tr>
<%
    	for(RestMessage user2:userList){
%>
    		     <tr align="center">
					<td><a href="menuQueryCtrl?currentPage=1&&rest_Id=<%=user2.getRest_Id() %>"><%=user2.getRest_Name() %></a></td>
					<td><%=user2.getRest_Telphone() %></td>
					<td><%=user2.getRest_Address() %></td>
					<td><%=user2.getRemark() %></td>
    		    </tr>	
<%
   		}
%>
</table>
<% 
if(pageNow != 1){
%>
		<a href="restQueryCtrl?dishStyleId=<%=dishStyleId %>&&currentPage=1">首页</a>
<% 
	}

	if(pageNow != 1){
%>
		<a href="restQueryCtrl?dishStyleId=<%=dishStyleId %>&&currentPage=<%=pageNow - 1 %>">上一页</a>
<% 
	}
	if(pageCount<=3){
		for(int i=pageNow;i<=pageNow;i++){
%>
			<a href="restQueryCtrl?dishStyleId=<%=dishStyleId %>&&currentPage=<%=i %>"><%=i %></a>
<%
		}
	}else{
		if(pageNow <= pageCount - 4){
			for(int i = pageNow; i <= pageNow + 4 ; i ++){
%>
				<a href="restQueryCtrl?dishStyleId=<%=dishStyleId %>&&currentPage=<%=i %>"><%=i %></a>
<% 
			}
		}else{
			for(int i = pageCount - 3; i <= pageCount; i ++){
%>
				<a href="restQueryCtrl?dishStyleId=<%=dishStyleId %>&&currentPage=<%=i %>"><%=i %></a>
<% 
			}
		}
	}
	if(pageNow>=pageCount){
%>
			<h5>已经是最后一页了</h5>
<% 
	}else{
		if(pageNow != pageCount){
%>
			<a href="restQueryCtrl?dishStyleId=<%=dishStyleId %>&&currentPage=<%=pageNow + 1 %>">下一页</a>
<% 
		}
		if(pageNow != pageCount){
%>
			<a href="restQueryCtrl?dishStyleId=<%=dishStyleId %>&&currentPage=<%=pageCount %>">尾页</a>
<% 
		}
	}
%>
		<h5>页次：<font color=red><%=pageNow %></font>/<%=pageCount %>&nbsp;&nbsp;每页：10&nbsp;&nbsp;共计：<%=pageCount %></h5>
</div>
	</body>
</html>
